#include <stdio.h>
#include <ctype.h> // 引入ctype.h头文件以使用isdigit函数,判断字符是不是数字，是，返回非零值，不是，返回0
int extract_numbers(const char *input_string, int *numbers) {
    int count = 0;
    int current_number = 0;
    int is_number = 0;
    while (*input_string != '\0') {
        if (isdigit(*input_string)) {
            current_number = current_number * 10 + (*input_string - '0');
            is_number = 1;
        } else {
            if (is_number) {
                numbers[count] = current_number;
                count++;
                current_number = 0;
                is_number = 0;
            }
        }
        input_string++;
    }
    if (is_number) {
        numbers[count] = current_number;
        count++;
    }
    return count;
}
int main() {
    char input_string[100];
    printf("请输入一个字符串：");
    fgets(input_string, sizeof(input_string), stdin);

    int numbers[100];
    int count = extract_numbers(input_string, numbers);

    printf("提取到的整数数量：%d\n", count);
    printf("提取到的整数为：");
    for (int i = 0; i < count; i++) {
        printf("%d ", numbers[i]);
    }
    printf("\n");

    return 0;
}